package com.loop.exception;

public class MyOwnExceptionTest {
    public static void main(String[] args) {
        int age = -1;
        try {
            checkAge(age);
        } catch (MyOwnException e) {
            e.printStackTrace();
            e.checkAge(age);
        }
    }

    public static void checkAge(int age) throws MyOwnException {
        if (age < 0 )
            throw new MyOwnException("年龄不合法");
    }
}
